package com.woniuxy.userassembly.dao;

import com.woniuxy.userassembly.model.RbacPermission;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Liyfi
 * @since 2021-05-22
 */
public interface RbacPermissionMapper extends BaseMapper<RbacPermission> {

    @Insert("insert into rbac_permission (permission_name) value(#{permissionName})")
    int addPermission(RbacPermission permission);

    @Delete("delete from rbac_permission where permission_id = #{permissionId}")
    int removePermission(int permissionId);

    @Update("update  rbac_permission set (username=#{username}) where permission_id = #{permissionId}")
    int updatePermissionName(RbacPermission permission);

    @Select("select * from rbac_permission where permission_id= #{permissionId}")
    RbacPermission selPermission(int permissionId);
}
